import request from "@/utils/request";
import { PATH_SYS_DNF} from "@/utils/constant";
import {Weapon} from "@/api/sys/dnf/weapon/types";

const baseUrl = PATH_SYS_DNF + '/weapon/'

/**
 * 查询武器列表 - 带分页
 * @param data
 */
export function getWeaponListApi(data: PageQuery<Weapon>): PromisePageListType<Weapon> {
    return request.post(baseUrl + 'list', data)
}

/**
 * 通过武器id获取武器信息
 * @param id
 */
export function getWeaponByIdApi(id: number): Promise<Weapon> {
    return request.get(baseUrl + id)
}

/**
 * 修改武器
 * @param id
 * @param data
 */
export function editWeaponApi(id:number,data: Weapon): Promise<any> {
    return request.patch(baseUrl+id, data)

}

/**
 * 添加武器
 * @param data
 */
export function addWeaponApi(data: Weapon): Promise<any> {
    return request.post(baseUrl, data)
}

/**
 * 删除武器
 * @param id
 */
export function deleteWeaponApi(id: number): Promise<any> {
    return request.delete(baseUrl + id)
}
